package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.entity.ShopType;
import com.hmdp.service.IShopTypeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 展示商业类型
 */
@RestController
@RequestMapping("/shop-type")
public class ShopTypeController {
    @Resource
    private IShopTypeService typeService;

    @GetMapping("list")
    public Result queryTypeList() {
        //改用redis查询缓存
        List<ShopType> typeList = typeService.queryByRedis();
//                .query().orderByAsc("sort").list();
        return Result.success(typeList);
    }

    @GetMapping("get")
    public Result getId(@RequestParam("id") int id) {
        return Result.success(typeService.getById(id));
    }
}
